<!Doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title></title>
<link href="bootstrap.min.def.css" rel="stylesheet">
 <script src="jquery-3.3.1.min.js"></script>
 <script src="bootstrap.min.js"></script>
 <script src="jquery.validate.min.js"></script>
 <script src="messages_zh.js"></script>
 <script>
 $.validator.setDefaults({
    submitHandler: function() {
      //alert("提交事件!");
	  //window.location.href="jquery_navbar/index.html";

	  $.ajax({
url: "http://120.27.32.237:83/common.ashx?method=login&username=abc&password=admin",
 context: document.body,
 dataType:'json',
 type:'POST',
 data:'username=admin&password=admin',
 success: function(){
        $(this).addClass("done");
		alert("SUCCESS");
      }
});

    }
});



jQuery.validator.addMethod("isPassword",function(value,element){
//var pas=/[A-Z]/.test(password.value.charAt(0));
var pas=/[A-Z]/;
return this.optional(element)||(pas.test(value.charAt(0)));
},"请正确填写您的密码");



 $().ready(function(){
  $("#signupForm").validate({
    rules:{
      username:{
        required:true,
        minlength: 3
      },
	   
      password:{
        required:true,
        minlength: 6,
		isPassword:true
      },
    
    },
    messages:{
      username:{
        required: "请输入用户名",
        minlength: "用户名必需由两个字母组成"
      },
      password:{
        required: "请输入密码",
        minlength: "密码长度不能小于6位",
		isPassword:"第一位为大写字母"
      },
    
     }
    });
});
 </script>
 <style>

 .form-horizontal{
 border:1px solid red;
 width:500px;
 }
 form-group{
    width: 1053px;
}
 </style>
</head>
<body>

<div class="bkg" align="center">
<div class="all" align="center">
<form class="form-horizontal" role="form" id="signupForm">

   <div class="form-group">
      <label for="firstname" class="col-sm-2 control-label">用户名</label>
      <div class="col-sm-10">
         <input type="text" class="form-control" id="username"  name="username" placeholder="请输入用户名">
      </div>
   </div>
   <div class="form-group">
      <label for="lastname" class="col-sm-2 control-label">密码</label>
      <div class="col-sm-10">
          <input type="password" class="form-control" id="password" name="password" placeholder="请输入密码">
      </div>
   </div>
   <div class="form-group">
      <div class="col-sm-offset-2 col-sm-10">
         <div class="checkbox">
            <label>
               <input type="checkbox"> 请记住我            </label>
         </div>
      </div>
   </div>
   <div class="form-group">
      <div class="col-sm-offset-2 col-sm-10">
         <button type="submit" class="btn btn-primary btn-lg">登录</button>
		  <button type="reset" class="btn btn-primary btn-lg">重置</button>
      </div>
   </div>
   
   <div class="form-group">
      <div class="col-sm-offset-2 col-sm-10">
         <div class="checkbox">

               <p> 还没账号?<a href="bootstrap表单提交2.html">立即注册</a></p>
         </div>
      </div>
   </div>
   
   </form>

</div>
</div>


</body>
</html>